<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<!--首先通过th:fragment定制片段 ，然后通过th:replace 填写片段路径和片段名-->

<!-- /views/common/head.html-->c
<head th:fragment="static">
    <script th:src="@{/js/demo.js}"></script>
</head>

<!-- /views/your.html -->
<div th:replace="~{common/head::static}"></div>